//
//  YJGItEmotionBtn.m
//  YJB
//
//  Created by YJB on 2017/1/21.
//  Copyright © 2017年 YJB. All rights reserved.
//

#import "YJGifEmotionBtn.h"
#import "YJGifEmotionModel.h"
#import "UIButton+Webcache.h"

@implementation YJGifEmotionBtn
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
//        self.backgroundColor = REDCOLOR;
        self.adjustsImageWhenHighlighted = NO;
    }
    return self;
}

-(void)setEmotion:(YJGifEmotionModel *)emotion
{
    _emotion = emotion;
    if (emotion.isAddBtn)
    {
        [self setImage:[UIImage imageNamed:@"emotion_collectionadd_icon"] forState:UIControlStateNormal];
    }else if (emotion.isDownload)
    {
        YJWeakSelf
        [weakSelf sd_setImageWithURL:[NSURL URLWithString:emotion.png] forState:UIControlStateNormal completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
        }];
    }else
      [self setImage:[UIImage imageNamed:emotion.png] forState:UIControlStateNormal];
}

@end
